#ifndef OSGLineTool_H
#define OSGLineTool_H

#include <osg/Geode>
#include <osgGe/Vec3d>
#include <osg/LineWidth>
#include <osgText/Text>
#include <osg/MatrixTransform>
#include <osg/LightSource>
#include <osg/Image>
#include <osg/Geometry>
#include <osgGe/Vec3>
#include <osgGe/Vec4>
#include <osg/Billboard>

#include <osg/Projection>

#include <OsgExTool/Export>

namespace OsgExTool {

	//图形工具集
class OsgExTool_EXPORT OSGLineTool
{
	public:

/**
 * @brief createLaneX
 * @param A       A, B,C,D是拟合方程
 * @param B
 * @param C
 * @param D
 * @param start
 * @param end
 * @param width   线宽
 * @param isTest  测试的死数据,参数可以去掉
 * @return
 */
static osg::ref_ptr<osg::Node> createLaneX(double A = 0, double B = 0, double C = 0, double D = 0, double start = 0, double end = 0, double width = 0.2, bool isTest = true);

/**
 * @brief 以下所有函数的参数含义相同 用于生成二维的线
 * @param points   输入的一系列点连起来形成线
 * @param width    输入线宽
 * @param color    开始颜色
 * @param color2   结束颜色,用于渐变
 * @return
 */

static  osg::ref_ptr<osg::Geode> createSingleLine(std::vector<osg::Vec3f>& points, double width, osg::Vec4 color);
static osg::ref_ptr<osg::Geode> createLaneLine(std::vector<osg::Vec3f>& points, double width, osg::Vec4 color);
static  osg::ref_ptr<osg::Geode> createSmoothLaneLine(std::vector<osg::Vec3f>& points, double width, osg::Vec4 color, osg::Vec4 color2, osg::Matrix mat = osg::Matrix::identity());

//extern "C" __declspec(dllexport) osg::ref_ptr<osg::Geode> createSmoothLaneLine(std::vector<osg::Vec3f>& points, double width, osg::Vec4 color, osg::Matrix mat = osg::Matrix::identity(), int div = 1 );

static osg::ref_ptr<osg::Geode> createSmoothLaneLine(std::vector<osg::Vec3f>& points, double width, osg::Vec4 color, osg::Matrix mat = osg::Matrix::identity(), int div = 1);

static osg::ref_ptr<osg::Geometry> createLine(std::vector<osg::Vec3f> points, osg::Vec4f color);
static osg::ref_ptr<osg::Geode> createLines(std::vector<osg::Vec3f>& points, osg::Vec4f color, bool isLoop = false);
static osg::ref_ptr<osg::Projection> createNormalLines(std::vector<osg::Vec3f>& points, osg::Vec4f color);

static osg::ref_ptr<osg::Geode> createPointGeode(std::vector<osg::Vec3f>& points, double size, osg::Vec4 color);
static std::vector<osg::Vec3f> insertPoints(std::vector<osg::Vec3f>& points, double num = 20);
static void reLayoutPoints(std::vector<osg::Vec3f>& points, double num, std::vector<osg::Vec3f>& outpt);

osg::ref_ptr<osg::Geode> createSmoothLaneLine(std::vector<osg::Vec2d>& points, double width, osg::Vec4 color, osg::Vec4 color2);

};

}

using namespace OsgExTool;
#endif


